//	--------------------------------------------------------------------
//	Copyright(C) 2006,2007 Zhao Yukun. All rights reserved.
//	This file is a part of the Xeres system.
//	Xeres 2007
//	Contact : xeres.engine@gmail.com
//	$(reservedInfo)
//	$(reservedDeclaration)
//	--------------------------------------------------------------------
///	@file	<CPythonInterpreter.h>
///	@path	~/src/python/interpreter/
///	@date	2007/12/07
///	@desc	Python interpreter implementation.

#pragma once

#include "xeres.h"

#include "object/IScriptInterpreter.h"

namespace xeres {

	/*!
		\class	CPythonInterpreter
		\brief	Python interpreter implementation.
	*/
	class CPythonInterpreter : public IScriptInterpreter
	{
	public:

		/// \ctor
		CPythonInterpreter( void );

		/// \dtor
		virtual ~CPythonInterpreter( void );

		DECL_IOBJECT_CLASS( CPythonInterpreter , IScriptInterpreter );

	public:

	//@ interface

		/*!
			\brief		Query current prompt.
		*/
		virtual const WString& QueryPrompt( void );

		/*!
			\brief		Execute interactive script.
		*/
		virtual InterpretResult RunInteractive( const WString& script , WString& cue );

		/*!
			\brief		Begin a lex state.
		*/
		virtual void * BeginLex( const WString& str );

		/*!
			\brief		Scan string & return its lex tag.
						Return LEX_EOF while end.
		*/
		virtual const LexAttr& NextLex( void * state , int& length );

		/*!
			\brief		End lex state.
		*/
		virtual void EndLex( void * state );

	private:

	//@ data
		// buffer
		AString			m_buffer;

		int				m_multiline;

		LexAttr			m_attrs[LEX_USER];
	};

} // namespace xeres
